package net.lab1024.sa.admin.module.business.ball.bo;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.google.common.collect.Lists;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 双色球开奖结果
 */
@Data
@TableName("tbl_double_color_lottery")
@NoArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
public class FuliBall implements Serializable {

    @TableId(type = IdType.AUTO)
    private Integer id;
    /**
     * 期号
     */
    private Integer phase;

    /**
     * 红色、蓝色号码
     */
    private Integer red1;

    private Integer red2;

    private Integer red3;

    private Integer red4;

    private Integer red5;

    private Integer red6;

    private Integer blue;
    /**
     * 开奖日期
     */
    private Date drawDate;
    /**
     * 说明信息
     */
    @TableField(exist = false)
    private String msg;

    public FuliBall(Integer phase,Integer red1,Integer red2,Integer red3,Integer red4,Integer red5,Integer red6,  Integer blueBall, Date drawDate) {
        this.phase = phase;
        this.red1 = red1;
        this.red2 = red2;
        this.red3 = red3;
        this.red4 = red4;
        this.red5 = red5;
        this.red6 = red6;
        this.blue = blueBall;
        this.drawDate = drawDate;
    }
    @JSONField(serialize=true)
    public List<Integer> redNums(){
        return Lists.newArrayList(red1, red2, red3, red4, red5, red6);
    }

    public void redNums(List<Integer> redList){
        this.red1 = redList.get(0);
        this.red2 = redList.get(1);
        this.red3 = redList.get(2);
        this.red4 = redList.get(3);
        this.red5 = redList.get(4);
        this.red6 = redList.get(5);
    }

}
